﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Data;
using ExtensionsLib.Dataset;

namespace Tests.DatasetExtensions
{
    [TestClass]
    public class DataTableTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            var table = GetTestDataTable();
            var dictionary = table.ToDictionary(0);
            Assert.AreEqual(dictionary.Count, table.Columns.Count);
        }
        

        public static DataTable GetTestDataTable()
        {

            DataTable table = new DataTable();

            table.Columns.Add("Dosage", typeof(int));
            table.Columns.Add("Drug", typeof(string));
            table.Columns.Add("Patient", typeof(string));
            table.Columns.Add("Date", typeof(DateTime));

            table.Rows.Add(25, "Indocin", "David", DateTime.Now);
            table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
            table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
            table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
            table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);

            return table;

        }
    }
}

